home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / forms / frmwiz / mainform.frm < prev    next >
Text File  |  1995-01-28  |  5KB  |  155 lines

  1. VERSION 2.00
  2. Begin Form MainForm
  3. HelpContextID = 1
  4. BackColor       =   &H00C0C0C0&
  5. Caption         =   "Form Wizard"
  6. ClientHeight    =   600
  7. ClientLeft      =   6315
  8. ClientTop       =   6015
  9. ClientWidth     =   2865
  10. ControlBox      =   0   'False
  11. Height          =   1005
  12. Icon            =   MAINFORM.FRX:0000
  13. Left            =   6255
  14. LinkTopic       =   "Form1"
  15. MaxButton       =   0   'False
  16. ScaleHeight     =   600
  17. ScaleWidth      =   2865
  18. Top             =   5670
  19. Width           =   2985
  20. Begin SSCommand BtnHelp
  21. Caption         =   "&Help"
  22. Font3D          =   2  'Raised w/heavy shading
  23. Height          =   615
  24. Left            =   1920
  25. Picture         =   MAINFORM.FRX:0302
  26. TabIndex        =   2
  27. Top             =   0
  28. Width           =   975
  29. End
  30. Begin SSCommand BtnExit
  31. Caption         =   "E&xit"
  32. Font3D          =   2  'Raised w/heavy shading
  33. Height          =   615
  34. Left            =   960
  35. Picture         =   MAINFORM.FRX:0604
  36. TabIndex        =   1
  37. Top             =   0
  38. Width           =   975
  39. End
  40. Begin SSCommand BtnNewForm
  41. Caption         =   "&New Form"
  42. Font3D          =   2  'Raised w/heavy shading
  43. Height          =   615
  44. Left            =   0
  45. Picture         =   MAINFORM.FRX:0906
  46. TabIndex        =   0
  47. Top             =   0
  48. Width           =   975
  49. End
  50. End
  51. Option Explicit
  52.  
  53. Sub BtnExit_Click ()
  54.     Dim AppName$, KeyName$, NewVal$, IniFileName$
  55.     On Error GoTo ExitErr
  56.     
  57.     EndItNow
  58.  
  59.     ' Same last position of mainform for next time
  60.     IniFileName$ = "FRMWIZRD.INI"        'name of ini file
  61.     AppName$ = "Form Wizard"             'Name of application or section heading
  62.     KeyName$ = "Left"          'Keyword or variable name
  63.     NewVal$ = Trim$(Str$(MainForm.Left))        'Left pos
  64.     SaveIni AppName$, IniFileName$, KeyName$, NewVal$
  65.     KeyName$ = "Top"          'Keyword or variable name
  66.     NewVal$ = Trim$(Str$(MainForm.Top))        'Top pos
  67.     SaveIni AppName$, IniFileName$, KeyName$, NewVal$
  68.  
  69.  
  70.     Cancel3D        ' Cancel the 3-D common dialogs
  71.     End
  72.     
  73. ExitErr:
  74.     erraction = RB_ErrorHandler("MainForm", "BtnExit_Click")
  75.     Select Case erraction
  76.     Case 1
  77.         Resume 0      ' Retry option selected
  78.     Case 2
  79.         Resume Next   ' Ignore option selected
  80.     End Select
  81.  
  82. End Sub
  83.  
  84. Sub BtnHelp_Click ()
  85.     ' TestForm.Show MODELESS
  86.     SendKeys "{F1}"
  87.  
  88. End Sub
  89.  
  90. Sub BtnNewForm_Click ()
  91.     EndingIt = False
  92.     RequiredFieldsComplete = "NNNN"      ' Indicate Required Fields not present
  93.     DataForm.Show MODELESS
  94.     MainForm.Hide
  95.  
  96. End Sub
  97.  
  98. Sub Form_Load ()
  99.     Dim AppName$, KeyName$, nDefault, Numeric%, DefaultStr$
  100.     Dim IniFileName$, nSize%
  101.     Dim ReturnStr As String      'Create an empty string to be filled
  102.     Dim LastLeft As Long, LastTop As Long
  103.     
  104.     On Error GoTo Loaderr
  105.  
  106.     rb_systemname = "RDB Form Wizard"
  107.     rb_version = "1.0"
  108.     quote = """"
  109.  
  110.     Rem start the 3D dialogs
  111.     Inst% = GetModuleHandle(App.EXEName)  ' Get program's ModuleHandle.
  112.     ret = Ctl3dRegister(Inst%)            ' Register program w/ Ctl3d.
  113.     ret = Ctl3dAutoSubclass(Inst%)        ' Subclass the program.
  114.  
  115.     NewRecordSource = False
  116.     EndingIt = False
  117.  
  118.     ' Check INI file to get last position
  119.     IniFileName$ = "FRMWIZRD.INI"        'name of ini file
  120.     AppName$ = "Form Wizard"             'Name of application or section heading
  121.     KeyName$ = "Left"          'Keyword or variable name
  122.     nDefault = 0                   'Default numeric value (for numeric variables)
  123.     DefaultStr$ = "0"  'Default string        (for String variables)
  124.     nSize% = 255                   'uncertain - possibly length of fill string
  125.     Numeric% = False               'Tell it we are looking for a string
  126.     ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr, Numeric%, IniFileName$
  127.     LastLeft = Val(ReturnStr)
  128.     KeyName$ = "Top"          'Keyword or variable name
  129.     nDefault = 0                   'Default numeric value (for numeric variables)
  130.     DefaultStr$ = "0"  'Default string        (for String variables)
  131.     ReturnStr = ""
  132.     nSize% = 255                   'uncertain - possibly length of fill string
  133.     Numeric% = False
  134.     ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr, Numeric%, IniFileName$
  135.     LastTop = Val(ReturnStr)
  136.  
  137.     If LastLeft > 0 And LastTop > 0 Then
  138.         MainForm.Left = LastLeft
  139.         MainForm.Top = LastTop
  140.     End If
  141.  
  142.     Exit Sub
  143.  
  144. Loaderr:
  145.     erraction = RB_ErrorHandler("MainForm", "Form_Load")
  146.     Select Case erraction
  147.     Case 1
  148.         Resume 0      ' Retry option selected
  149.     Case 2
  150.         Resume Next   ' Ignore option selected
  151.     End Select
  152.  
  153. End Sub
  154.  
  155.